#ifndef __OATESTER_H__
#define __OATESTER_H__

#if defined(OPEN_AUTOMATE)

#include <inc/OpenAutomate.h>
#include <vector>


class OATester : public ISystemEventListener
{
	// ISystemEventListener
public:
	virtual void OnSystemEvent(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam);

public:
	OATester(const char* arg);
	virtual ~OATester();

	void PreUpdate();
	void PostUpdate();

private:
	enum TestState
	{
		EXIT_APPLICATION = -1,
		RUN = 0,
		RUN_BENCHMARK = 1,
		END_BENCHMARK = 2,
		FIRST_RUN = 3
	};

private:
	void InitOptions();

	void AddOption(const char*, oaOptionDataType type);
	void AddOptionString(const char* name);
	void AddOptionBool(const char* name);
	void AddOptionInt(const char* name, int min, int max, int numSteps = 0);
	void AddOptionFloat(const char* name, float max, float min, int numSteps = 0);
	void AddOptionEnum(const char* name, const char* enumValue);

	void GetAllOptions();
	void GetCurrentOptions();
	void GetBenchmarks();
	void LoadBenchmark(const char* benchmarkName);
	void LoadBenchmarkConfiguration(const char* cfg);
	void SetOptions();

	oaCommand GetNextCommand();
	void ReadOaCommands();

	void StartBenchmark();
	void EndBenchmark();
	void DisplayFrame(float appTime);

	bool ShouldReloadCommands();

private:
	TestState m_curTestState;
	std::vector<oaNamedOption> m_options;
};


#endif // #if defined(OPEN_AUTOMATE)

#endif // #ifndef __OATESTER_H__
